import * as TYPES from "../action-types";
import { Map } from "immutable"; //fromJS深层比较 Map浅层

// let initState = {
//     topBanners:[]
// }
let initState = Map({
  topBanners: [],
  hotRecommends: [],
  newAlbums: [],

  // 榜单数据
  upRanking: {},
  newRanking: {},
  originRanking: {},

  // 右侧
  artistList:[] //入驻歌手数据 
});
function recommend(state = initState, action) {
  // state = JSON.parse(JSON.stringify(state))
  const { type, payload } = action;
  switch (type) {
    case TYPES.BANNER:
      // state.topBanners = payload ;
      return state.set("topBanners", payload);
    //    break;
    case TYPES.HOT_RECOMMEND:
      return state.set("hotRecommends", payload);
    case TYPES.NEW_ALBUMS:
      return state.set("newAlbums", payload);

      case TYPES.UP_RANKING:
      return state.set("upRanking", payload);
      case TYPES.NEW_RANKING:
      return state.set("newRanking", payload);
      case TYPES.ORIGIN_RANKING:
      return state.set("originRanking", payload);
      case TYPES.ARTIST_LIST:
        return state.set("artistList", payload);


    default:
      return state;
    // break;
  }
}

export default recommend;
